<?php
global $base_path;

function qgdi_preprocess_page(&$vars){
    
    $intArg1 = arg(1);
    if(arg(0) == "node" && is_numeric($intArg1)){
        $node = node_load($intArg1);
        if($node->type == "blog" || $node->type == "comunicacao"){
            $vars['theme_hook_suggestions'][] = 'page__noticias';
        }
    }else if(arg(0) == "taxonomy"&& arg(1) == "term"){
        $objTaxonomia = taxonomy_term_load(arg(2));
        if($objTaxonomia->vocabulary_machine_name == "estado"){
          $vars['theme_hook_suggestions'][] = 'taxonomy_term__estado';
        }
    }
    
    
}

function qgdi_preprocess_node(&$vars) {
    
    if ($vars['teaser'] and $vars['type'] == 'empreendimento') {
      $vars['theme_hook_suggestions'][] = 'node__empreendimento__teaser';
    }
  
    if ($vars['teaser'] and $vars['type'] == 'comunicacao') {
        $vars['theme_hook_suggestions'][] = 'node__comunicacao__teaser';
    }else if($vars['type'] == 'comunicacao') {
      $vars['theme_hook_suggestions'][] = 'node__comunicacao';
    }
    
    if($vars['teaser'] and $vars['type'] == 'blog') {
      $vars['theme_hook_suggestions'][] = 'node__blog__teaser';
    }elseif($vars['type'] == 'blog') {
      $vars['theme_hook_suggestions'][] = 'node__blog';
    }
}
